package model

import (
	"cabinet/pkg/global"
	"gorm.io/gorm"
	"strconv"
)

// UserInfo 用户模型
type UserInfo struct {
	BaseModel
	NickName string `gorm:"column:nick_name;" json:"nick_name"`
	Mobile   string `gorm:"column:mobile" json:"mobile"`
	UnionId  string `gorm:"column:union_id" json:"union_id"`
	OpenId   string `gorm:"size:1000"`
	Status   int    `gorm:"column:status" json:"status"`
}

func GetUserInfoTable() *gorm.DB {
	return global.Mysql.Model(&UserInfo{})
}

// UserID 返回string版的uid
func (user *UserInfo) UserID() string {
	return strconv.Itoa(int(user.ID))
}
